//package legorobot;

/**
 *
 * @author Daniel Van Eck
 */
public class TurnLeftCmd extends Command {
    private static final String myName = "TurnLeft";
    
    public TurnLeftCmd(LouieControl c) {
        super(myName, c);
    }
    
    public void execute() {
        cntrl.updateDisplay("EXE:" + getName());
        
        cntrl.getLeftMotor().shutdown();
        cntrl.getRightMotor().shutdown();
        
        cntrl.getLeftMotor().setSpeed(SPEED);
        cntrl.getRightMotor().setSpeed(SPEED);
        cntrl.getLeftMotor().setPower(POWER);
        cntrl.getRightMotor().setPower(POWER);
        
        cntrl.getLeftMotor().backward();
        cntrl.getRightMotor().forward();
        
        cntrl.waitFor(TURN_LEFT_TIME);
        
        cntrl.getLeftMotor().setSpeed(STOPPED);
        cntrl.getRightMotor().setSpeed(STOPPED);
        
        cntrl.getLeftMotor().stop();
        cntrl.getRightMotor().stop();
    }
    
    public Command getOpposite() {
        return new TurnRightCmd(cntrl);
        
        
    }
    
    /*
     * Returns the String representation of this cmd for use with server
     * communication
     */
    public static String getStringRep() {
        return myName;
    }
}
